package com.qfedu.empproject.service.impl;

import com.qfedu.empproject.dao.ManagerDao;
import com.qfedu.empproject.dao.impl.ManagerDaoImpl;
import com.qfedu.empproject.entity.Manager;
import com.qfedu.empproject.service.ManagerService;

import java.util.Objects;


public class ManagerServiceImpl implements ManagerService {
    private ManagerDao managerDao = new ManagerDaoImpl();
    @Override
    public int regist(Manager manager) {
        return managerDao.insert(manager);
    }

    @Override
    public Manager login(String name, String password) {
        Manager manager = managerDao.selectOne(name);
        if(Objects.nonNull(manager)){
            if(Objects.equals(manager.getPassword(),password)){
                return manager;
            }
        }
        return null;
    }
}
